package com.lantu.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lantu.sys.entity.Discipline;
import com.lantu.sys.mapper.DisciplineMapper;
import com.lantu.sys.service.DisciplineService;
import org.springframework.stereotype.Service;

@Service
public class DisciplineServiceImpl extends ServiceImpl<DisciplineMapper, Discipline> implements DisciplineService {


    @Override
    public IPage<Discipline> getxueke(Page<Discipline> pageParam, Discipline discipline) {


        QueryWrapper<Discipline> studentQueryWrapper =new QueryWrapper<>();
        if(!StringUtils.isEmpty(discipline.getCategory())){
            studentQueryWrapper.like("category",discipline.getCategory());
        }
        if(!StringUtils.isEmpty(discipline.getJudgment())){
            studentQueryWrapper.like("judgment",discipline.getJudgment());
        }
        studentQueryWrapper.orderByAsc("id");
        Page<Discipline> studentPage = baseMapper.selectPage(pageParam, studentQueryWrapper);
        return studentPage;

    }
}
